﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AMOOF {
    public partial class ModelPanel : UserControl {
        
        public ModelPanel() {
            InitializeComponent();
            BackColor = Color.Azure;
            this.MaximumSize = new Size(381, 34);
        }
        private string name = "";

        public OnOffButton OnOffButton { 
            get { 
                return Reflector.GetField<OnOffButton>("btn" + name, this); 
            } 
        }

        public Label Label { 
            get { 
                return Reflector.GetField<Label>("lbl" + name, this); 
            } 
        }

        public new string Name {
            set {
                base.Name += value;
                nameControls(value);
            }
            get {
                return base.Name;
            }

        }

        private void nameControls(string name) {
            if (!name.Equals("pnl")) {
                this.btn.Name += name;
                this.lbl.Name += name;
            }
        }
    }
}
